#include "ObjectPool.h"
#include <vector>

const int N = 10000000;

class ListNode
{
private:
	ListNode* _left;
	ListNode* _right;
	int _val;
};

int main()
{
	ObjectPool<ListNode> obpool;
	int clock1 = clock();
	for (int i = 0; i < N; i++)
	{
		auto ptr = obpool.New();
		obpool.Delete(ptr);
	}
	int clock2 = clock();
	std::cout << (clock2 - clock1) << std::endl;
	

	int clock3 = clock();
	vector<ListNode*> v;
	for (int i = 0; i < N; i++)
	{
		v.push_back(new ListNode);
		v.pop_back();
	}
	int clock4 = clock();
	std::cout << (clock4 - clock3) << std::endl;


	return 0;
}